package com.web44.springboot.web;

import com.web44.springboot.bean.Emp;
import com.web44.springboot.utils.ResponseVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
 * @Title: StudentController
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/3/4 14:38
 */
@RestController
@RequestMapping("emp")
@Tag(name = "EmpControllerApi",description = "员工api")
public class EmpController {


    @PostMapping("add")
    @Operation(summary = "新增员工")
    public ResponseVo addEmp(@RequestBody @Parameter(name = "员工") Emp emp) {
        return ResponseVo.ok("新增成功！");
    }

    @PutMapping("edit")
    @Operation(summary = "修改员工")
    public ResponseVo editEmp(@RequestBody @Parameter(name = "员工") Emp emp) {
        return ResponseVo.ok("修改成功！");
    }

    @GetMapping("emp/{id}")
    @Operation(summary = "按编号检索员工")
    public ResponseVo queryEmpById(@PathVariable("id") @Parameter(name = "员工编号") String id) {
        return ResponseVo.ok("检索成功",new Emp());
    }

    @GetMapping("emp")
    @Operation(summary = "检索全部员工")
    public ResponseVo queryEmps() {
        return ResponseVo.ok("检索成功", Arrays.asList(new Emp(),new Emp()));
    }

    @DeleteMapping("emp/{id}")
    @Operation(summary = "删除员工")
    public ResponseVo deleteEmpById(@PathVariable("id") @Parameter(name = "员工编号")  String id) {
        return ResponseVo.ok("删除成功",new Emp());
    }



}
